$(function() {
  $('a.tiga').click(function () {
    $('#tutup').fadeIn()
  });
  $('span.b').click(function () {
    $('#tutup').fadeOut()
  });
  $('a.blog-pager-newer-link, a.blog-pager-older-link').click(function () {
    $('body').fadeOut('slow');
    $('body').css({
      background: '#000'
    });
  });
  $('ul.bunder a, .comment-header a').attr({
    'target': '_blank'
  });
  $('.open-dialog').click(function () {
    $('#kotak-dialog').show().find('#iframeContainer').html('<iframe src="' + this.href + '"></iframe>');
    $('#dialog-overlay').fadeTo(400, 0.8);
    return false
  });
  $('#kotak-dialog .close').click(function () {
    $('#kotak-dialog').fadeOut('normal', function () {
      $('iframe', this).remove()
    });
    $('#dialog-overlay').hide();
    return false
  });
  $('.boeka').click(function () {
    $('.comments').css({
      height: '350px',
      overflow: 'auto'
    });
  });
$('a[href*="#"]').on('click',function(){
var x = $(this).attr('href');
$('html,body').animate({
'scrollTop' : $(x).offset().top - 5
});
return false
});
$('img[src="http://img1.blogblog.com/img/anon36.png"]').attr('src','http://lh3.googleusercontent.com/-spqfTyb5Ecw/UU3KqZ8UOAI/AAAAAAAADbE/dnEGT65LlU8/h120/system_black.png');

$('#comment-holder .comment .comment-header').next('p').children('a').addClass('removed');    
$('#comment-holder .comment .comment-header:contains("Zhinto")').next('p').children('a').addClass('author-link').removeClass('removed');
$('#comment-holder .comment .comment-header').next('p').children('.removed').remove();

  function autoSelect(elem) {
    var selection, range;
    if(window.getSelection) {
      selection = window.getSelection();
      range = document.createRange();
      range.selectNodeContents(elem);
      selection.removeAllRanges();
      selection.addRange(range)
    } else if(document.selection) {
      selection = document.selection.createRange().text;
      range = document.body.createTextRange();
      range.moveToElementText(elem);
      range.select()
    }
  }
  var pre = document.getElementsByTagName('pre');
  for(var i = 0, len = pre.length; i < len; i++) {
    pre[i].onclick = function () {
      autoSelect(this)
    }
  };
  var em = document.getElementsByClassName('em');
  for(var i = 0, len = em.length; i < len; i++) {
    em[i].onclick = function () {
      autoSelect(this)
    }
  };
    document.onkeyup = function (event) {
    if (document.activeElement.nodeName == 'TEXTAREA' || document.activeElement.nodeName == 'INPUT') return;
    event = event || window.event;
    switch (event.keyCode) {
      case 37:
        var newerLink = document.getElementById('Blog1_blog-pager-newer-link');
        if (newerLink != null) window.location.href = newerLink.href;
        break;
      case 39:
        var olderLink = document.getElementById('Blog1_blog-pager-older-link');
        if (olderLink != null) window.location.href = olderLink.href;
    }
  };
});